/***************************************************************************
 *   Copyright (C) 2008 by Thomas Richards   *
 *   thomi@colon   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef APPLICATION_H
#define APPLICATION_H

#include "project.h"

#include <QObject>
#include <QMap>

class ProjectScheduler;

/**
The application class is responsible for reading hte main config file and creating the projects as required. It also manages projects, sending them signals when they are due to start a new scan of the source.

	@author Thomas Richards <thomi@colon>
*/
class Application : public QObject
{
Q_OBJECT
public:
    Application(QObject *parent = 0);

    ~Application();
	
// Member Functions
	void runDaemon();
	void createProject(const QString &strProjectPath);
	void runProject(const QString &strProjectPath);
	void printUsage();
	
signals:
	void quit();
	
private slots:
	void projectStateChanged(Project::tProjectState nState);
	
private:
	// parse central config file:
	void parseConfig();
	// scan for plugins, and register them:
	void scanPlugins();
	// create a new project at the given location:
	void makeNewProject(const QString &strLocation);

	QString m_strPluginPath;
	ProjectScheduler *m_pProjectScheduler;

};

#endif
